home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / develop™ Technical Journal / develop Issue 9 code / NeoTextBox.sea / NeoTextBox / NeoTextBox.c < prev    next >
MacBinary  |  1992-01-06  |  12.4 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Mon Jan 6 10:50:33 1992, modified Mon Jan 6 10:50:33 1992, creator 'MPS ', type ASCII, 11981 bytes "NeoTextBox.c" , at 0x2f4d 428 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0c 4e 65 6f 54 65 78 | 74 42 6f 78 2e 63 00 00 |..NeoTex|tBox.c..|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 2e cd 00 | 00 01 ac a5 8e 2b 49 a5 |........|.....+I.|
|00000060| 8e 2b 49 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.+I.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 c2 0c 00 00 |........|........|
|00000080| 2f 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |/*******|********|
|00000090| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000000a0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000000b0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000000c0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000000d0| 2a 0d 0d 4e 65 6f 54 65 | 78 74 42 6f 78 2e 63 20 |*..NeoTe|xtBox.c |
|000000e0| 2d 20 61 20 72 65 70 6c | 61 63 65 6d 65 6e 74 20 |- a repl|acement |
|000000f0| 66 6f 72 20 54 65 78 74 | 42 6f 78 0d 0d 57 72 69 |for Text|Box..Wri|
|00000100| 74 74 65 6e 20 62 79 20 | 42 72 79 61 6e 20 4b 2e |tten by |Bryan K.|
|00000110| 20 52 65 73 73 6c 65 72 | 20 28 42 65 61 6b 65 72 | Ressler| (Beaker|
|00000120| 29 0d 0d 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |)..*****|********|
|00000130| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000140| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000150| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000160| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000170| 2a 2a 2a 2f 0d 23 69 6e | 63 6c 75 64 65 20 22 4e |***/.#in|clude "N|
|00000180| 54 42 44 65 6d 6f 2e 68 | 22 0d 23 69 6e 63 6c 75 |TBDemo.h|".#inclu|
|00000190| 64 65 20 22 4e 65 6f 54 | 65 78 74 42 6f 78 2e 68 |de "NeoT|extBox.h|
|000001a0| 22 0d 0d 2f 2a 2a 20 53 | 54 41 54 49 43 20 50 52 |"../** S|TATIC PR|
|000001b0| 4f 54 4f 54 59 50 45 53 | 20 2a 2a 2a 2a 2a 2a 2a |OTOTYPES| *******|
|000001c0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000001d0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000001e0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000001f0| 2a 2a 2a 2f 0d 73 74 61 | 74 69 63 20 75 6e 73 69 |***/.sta|tic unsi|
|00000200| 67 6e 65 64 20 73 68 6f | 72 74 20 4e 54 42 4c 69 |gned sho|rt NTBLi|
|00000210| 6e 65 48 65 69 67 68 74 | 28 75 6e 73 69 67 6e 65 |neHeight|(unsigne|
|00000220| 64 20 63 68 61 72 20 2a | 74 68 65 54 65 78 74 2c |d char *|theText,|
|00000230| 20 75 6e 73 69 67 6e 65 | 64 20 6c 6f 6e 67 20 74 | unsigne|d long t|
|00000240| 65 78 74 4c 65 6e 2c 0d | 09 52 65 63 74 20 2a 77 |extLen,.|.Rect *w|
|00000250| 72 61 70 42 6f 78 2c 20 | 73 68 6f 72 74 20 6c 68 |rapBox, |short lh|
|00000260| 43 6f 64 65 2c 20 73 68 | 6f 72 74 20 2a 73 74 61 |Code, sh|ort *sta|
|00000270| 72 74 59 29 3b 0d 73 74 | 61 74 69 63 20 76 6f 69 |rtY);.st|atic voi|
|00000280| 64 20 4e 54 42 44 72 61 | 77 28 53 74 79 6c 65 64 |d NTBDra|w(Styled|
|00000290| 4c 69 6e 65 42 72 65 61 | 6b 43 6f 64 65 20 62 72 |LineBrea|kCode br|
|000002a0| 65 61 6b 43 6f 64 65 2c | 20 75 6e 73 69 67 6e 65 |eakCode,| unsigne|
|000002b0| 64 20 63 68 61 72 20 2a | 6c 69 6e 65 53 74 61 72 |d char *|lineStar|
|000002c0| 74 2c 0d 09 6c 6f 6e 67 | 20 6c 69 6e 65 42 79 74 |t,..long| lineByt|
|000002d0| 65 73 2c 20 52 65 63 74 | 20 2a 77 72 61 70 42 6f |es, Rect| *wrapBo|
|000002e0| 78 2c 20 73 68 6f 72 74 | 20 61 6c 69 67 6e 2c 20 |x, short| align, |
|000002f0| 73 68 6f 72 74 20 63 75 | 72 59 2c 20 73 68 6f 72 |short cu|rY, shor|
|00000300| 74 20 62 6f 78 57 69 64 | 74 68 29 3b 0d 0d 2f 2a |t boxWid|th);../*|
|00000310| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000320| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000330| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000340| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000350| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 0d |********|*******.|
|00000360| 2a 0d 2a 20 4e 54 42 4c | 69 6e 65 48 65 69 67 68 |*.* NTBL|ineHeigh|
|00000370| 74 20 2d 20 66 69 67 75 | 72 65 73 20 6c 69 6e 65 |t - figu|res line|
|00000380| 20 68 65 69 67 68 74 0d | 2a 0d 2a 20 49 6e 70 75 | height.|*.* Inpu|
|00000390| 74 3a 09 74 68 65 54 65 | 78 74 09 09 74 68 65 20 |t:.theTe|xt..the |
|000003a0| 65 6e 74 69 72 65 20 74 | 65 78 74 20 74 68 61 74 |entire t|ext that|
|000003b0| 20 77 61 73 20 67 69 76 | 65 6e 20 74 6f 20 74 68 | was giv|en to th|
|000003c0| 65 20 4e 65 6f 54 65 78 | 74 42 6f 78 20 63 61 6c |e NeoTex|tBox cal|
|000003d0| 6c 0d 2a 09 09 09 74 65 | 78 74 4c 65 6e 09 09 74 |l.*...te|xtLen..t|
|000003e0| 68 65 20 6c 65 6e 67 74 | 68 20 69 6e 20 62 79 74 |he lengt|h in byt|
|000003f0| 65 73 20 6f 66 20 74 68 | 65 20 74 65 78 74 0d 2a |es of th|e text.*|
|00000400| 09 09 09 6c 68 43 6f 64 | 65 09 09 74 68 65 20 6c |...lhCod|e..the l|
|00000410| 69 6e 65 20 68 65 69 67 | 68 74 20 63 6f 64 65 20 |ine heig|ht code |
|00000420| 74 68 61 74 20 77 61 73 | 20 70 61 73 73 65 64 20 |that was| passed |
|00000430| 74 6f 20 4e 65 6f 54 65 | 78 74 42 6f 78 0d 2a 09 |to NeoTe|xtBox.*.|
|00000440| 09 09 73 74 61 72 74 59 | 09 09 56 41 52 20 2d 20 |..startY|..VAR - |
|00000450| 77 65 20 72 65 74 75 72 | 6e 20 74 68 65 20 73 74 |we retur|n the st|
|00000460| 61 72 74 69 6e 67 20 76 | 65 72 74 69 63 61 6c 20 |arting v|ertical |
|00000470| 70 65 6e 20 6c 6f 63 61 | 74 69 6f 6e 20 68 65 72 |pen loca|tion her|
|00000480| 65 0d 2a 0d 2a 20 4f 75 | 74 70 75 74 3a 09 72 65 |e.*.* Ou|tput:.re|
|00000490| 74 75 72 6e 73 20 74 68 | 65 20 6c 69 6e 65 20 68 |turns th|e line h|
|000004a0| 65 69 67 68 74 20 74 6f | 20 75 73 65 0d 2a 09 09 |eight to| use.*..|
|000004b0| 09 0d 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |..******|********|
|000004c0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000004d0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000004e0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000004f0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000500| 2a 2a 2f 0d 75 6e 73 69 | 67 6e 65 64 20 73 68 6f |**/.unsi|gned sho|
|00000510| 72 74 20 4e 54 42 4c 69 | 6e 65 48 65 69 67 68 74 |rt NTBLi|neHeight|
|00000520| 28 75 6e 73 69 67 6e 65 | 64 20 63 68 61 72 20 2a |(unsigne|d char *|
|00000530| 74 68 65 54 65 78 74 2c | 20 75 6e 73 69 67 6e 65 |theText,| unsigne|
|00000540| 64 20 6c 6f 6e 67 20 74 | 65 78 74 4c 65 6e 2c 0d |d long t|extLen,.|
|00000550| 09 52 65 63 74 20 2a 77 | 72 61 70 42 6f 78 2c 20 |.Rect *w|rapBox, |
|00000560| 73 68 6f 72 74 20 6c 68 | 43 6f 64 65 2c 20 73 68 |short lh|Code, sh|
|00000570| 6f 72 74 20 2a 73 74 61 | 72 74 59 29 0d 7b 0d 09 |ort *sta|rtY).{..|
|00000580| 73 68 6f 72 74 09 09 09 | 61 73 63 2c 64 65 73 63 |short...|asc,desc|
|00000590| 3b 09 2f 2a 20 55 73 65 | 64 20 69 6e 20 74 68 65 |;./* Use|d in the|
|000005a0| 20 4f 75 74 6c 69 6e 65 | 4d 65 74 72 69 63 73 20 | Outline|Metrics |
|000005b0| 63 61 6c 6c 73 20 2a 2f | 0d 09 46 6f 6e 74 49 6e |calls */|..FontIn|
|000005c0| 66 6f 09 09 66 49 6e 66 | 6f 3b 09 09 2f 2a 20 54 |fo..fInf|o;../* T|
|000005d0| 68 65 20 6f 6c 64 2d 73 | 74 79 6c 65 20 66 6f 6e |he old-s|tyle fon|
|000005e0| 74 20 69 6e 66 6f 72 6d | 61 74 69 6f 6e 20 72 65 |t inform|ation re|
|000005f0| 63 6f 72 64 20 2a 2f 0d | 09 50 6f 69 6e 74 09 09 |cord */.|.Point..|
|00000600| 09 66 72 61 63 3b 09 09 | 2f 2a 20 54 68 65 20 66 |.frac;..|/* The f|
|00000610| 72 61 63 74 69 6f 6e 20 | 66 6f 72 20 74 68 65 20 |raction |for the |
|00000620| 54 72 75 65 54 79 70 65 | 20 63 61 6c 6c 73 20 2a |TrueType| calls *|
|00000630| 2f 0d 09 75 6e 73 69 67 | 6e 65 64 20 73 68 6f 72 |/..unsig|ned shor|
|00000640| 74 09 6c 69 6e 65 48 65 | 69 67 68 74 3b 09 2f 2a |t.lineHe|ight;./*|
|00000650| 20 54 68 65 20 72 65 74 | 75 72 6e 20 76 61 6c 75 | The ret|urn valu|
|00000660| 65 20 2a 2f 0d 0d 09 47 | 65 74 46 6f 6e 74 49 6e |e */...G|etFontIn|
|00000670| 66 6f 28 26 66 49 6e 66 | 6f 29 3b 0d 09 69 66 20 |fo(&fInf|o);..if |
|00000680| 28 6c 68 43 6f 64 65 20 | 3c 20 30 29 20 7b 0d 0d |(lhCode |< 0) {..|
|00000690| 09 09 2f 2a 0d 09 09 09 | 49 66 20 74 68 65 20 75 |../*....|If the u|
|000006a0| 73 65 72 20 68 61 73 20 | 73 70 65 63 69 66 69 65 |ser has |specifie|
|000006b0| 64 20 76 61 72 69 61 62 | 6c 65 2d 68 65 69 67 68 |d variab|le-heigh|
|000006c0| 74 20 6c 69 6e 65 73 2c | 20 77 65 20 6e 65 65 64 |t lines,| we need|
|000006d0| 20 74 6f 20 74 72 79 0d | 09 09 09 74 6f 20 64 65 | to try.|...to de|
|000006e0| 74 65 72 6d 69 6e 65 20 | 74 68 65 20 74 61 6c 6c |termine |the tall|
|000006f0| 65 73 74 20 61 73 63 65 | 6e 74 20 69 6e 20 74 68 |est asce|nt in th|
|00000700| 65 20 67 69 76 65 6e 20 | 74 65 78 74 2e 20 20 57 |e given |text. W|
|00000710| 65 20 63 61 6e 20 6f 6e | 6c 79 0d 09 09 09 72 65 |e can on|ly....re|
|00000720| 61 6c 6c 79 20 64 6f 20 | 74 68 69 73 20 69 66 20 |ally do |this if |
|00000730| 74 68 65 20 66 6f 6e 74 | 20 69 73 20 61 20 54 72 |the font| is a Tr|
|00000740| 75 65 54 79 70 65 20 66 | 6f 6e 74 2e 20 20 4f 74 |ueType f|ont. Ot|
|00000750| 68 65 72 77 69 73 65 2c | 20 77 65 0d 09 09 09 70 |herwise,| we....p|
|00000760| 75 6e 74 20 61 6e 64 20 | 75 73 65 20 6f 6c 64 2d |unt and |use old-|
|00000770| 66 61 73 68 69 6f 6e 65 | 64 20 47 65 74 46 6f 6e |fashione|d GetFon|
|00000780| 74 49 6e 66 6f 20 6e 75 | 6d 62 65 72 73 2e 0d 09 |tInfo nu|mbers...|
|00000790| 09 2a 2f 0d 0d 09 09 66 | 72 61 63 2e 68 20 3d 20 |.*/....f|rac.h = |
|000007a0| 66 72 61 63 2e 76 20 3d | 20 31 3b 0d 09 09 69 66 |frac.v =| 1;...if|
|000007b0| 20 28 67 48 61 73 54 72 | 75 65 54 79 70 65 20 26 | (gHasTr|ueType &|
|000007c0| 26 20 49 73 4f 75 74 6c | 69 6e 65 28 66 72 61 63 |& IsOutl|ine(frac|
|000007d0| 2c 20 66 72 61 63 29 29 | 20 7b 0d 0d 09 09 09 2f |, frac))| {...../|
|000007e0| 2a 0d 09 09 09 09 41 74 | 20 74 68 69 73 20 70 6f |*.....At| this po|
|000007f0| 69 6e 74 20 77 65 20 6b | 6e 6f 77 20 74 68 65 20 |int we k|now the |
|00000800| 63 75 72 72 65 6e 74 20 | 66 6f 6e 74 20 69 73 20 |current |font is |
|00000810| 61 20 54 72 75 65 54 79 | 70 65 20 66 6f 6e 74 2c |a TrueTy|pe font,|
|00000820| 20 73 6f 0d 09 09 09 09 | 77 65 20 64 6f 20 61 6e | so.....|we do an|
|00000830| 20 4f 75 74 6c 69 6e 65 | 4d 65 74 72 69 63 73 20 | Outline|Metrics |
|00000840| 63 61 6c 6c 20 77 69 74 | 68 20 6f 75 72 20 66 75 |call wit|h our fu|
|00000850| 6c 6c 20 74 65 78 74 2e | 20 20 49 74 20 77 69 6c |ll text.| It wil|
|00000860| 6c 20 70 75 74 0d 09 09 | 09 09 74 68 65 20 74 61 |l put...|..the ta|
|00000870| 6c 6c 65 73 74 20 63 68 | 61 72 61 63 74 65 72 20 |llest ch|aracter |
|00000880| 61 73 63 65 6e 74 20 69 | 6e 74 6f 20 61 73 63 2c |ascent i|nto asc,|
|00000890| 20 61 6e 64 20 74 68 65 | 20 64 65 65 70 65 73 74 | and the| deepest|
|000008a0| 20 64 65 73 63 65 6e 74 | 0d 09 09 09 09 69 6e 74 | descent|.....int|
|000008b0| 6f 20 64 65 73 63 2e 20 | 20 54 68 65 6e 20 77 65 |o desc. | Then we|
|000008c0| 20 63 68 6f 6f 73 65 20 | 62 65 74 77 65 65 6e 20 | choose |between |
|000008d0| 77 68 69 63 68 65 76 65 | 72 27 73 20 6d 6f 73 74 |whicheve|r's most|
|000008e0| 20 62 65 74 77 65 65 6e | 0d 09 09 09 09 74 68 65 | between|.....the|
|000008f0| 20 6f 6c 64 2d 73 74 79 | 6c 65 20 61 73 63 65 6e | old-sty|le ascen|
|00000900| 74 2f 64 65 73 63 65 6e | 74 20 61 6e 64 20 74 68 |t/descen|t and th|
|00000910| 65 20 6e 75 6d 62 65 72 | 73 20 77 65 20 67 65 74 |e number|s we get|
|00000920| 20 66 72 6f 6d 0d 09 09 | 09 09 74 68 65 20 4f 75 | from...|..the Ou|
|00000930| 74 6c 69 6e 65 4d 65 74 | 72 69 63 73 20 63 61 6c |tlineMet|rics cal|
|00000940| 6c 2e 0d 09 09 09 2a 2f | 0d 0d 09 09 09 4f 75 74 |l.....*/|.....Out|
|00000950| 6c 69 6e 65 4d 65 74 72 | 69 63 73 28 28 73 68 6f |lineMetr|ics((sho|
|00000960| 72 74 29 74 65 78 74 4c | 65 6e 2c 20 74 68 65 54 |rt)textL|en, theT|
|00000970| 65 78 74 2c 20 66 72 61 | 63 2c 20 66 72 61 63 2c |ext, fra|c, frac,|
|00000980| 20 26 61 73 63 2c 20 26 | 64 65 73 63 2c 0d 09 09 | &asc, &|desc,...|
|00000990| 09 09 6e 69 6c 2c 20 6e | 69 6c 2c 20 6e 69 6c 29 |..nil, n|il, nil)|
|000009a0| 3b 0d 09 09 09 6c 69 6e | 65 48 65 69 67 68 74 20 |;....lin|eHeight |
|000009b0| 3d 20 4d 41 58 4f 46 28 | 66 49 6e 66 6f 2e 61 73 |= MAXOF(|fInfo.as|
|000009c0| 63 65 6e 74 2c 20 61 73 | 63 29 20 2b 20 4d 41 58 |cent, as|c) + MAX|
|000009d0| 4f 46 28 66 49 6e 66 6f | 2e 20 64 65 73 63 65 6e |OF(fInfo|. descen|
|000009e0| 74 2c 2d 64 65 73 63 29 | 20 2b 0d 09 09 09 09 66 |t,-desc)| +.....f|
|000009f0| 49 6e 66 6f 2e 6c 65 61 | 64 69 6e 67 3b 0d 09 09 |Info.lea|ding;...|
|00000a00| 09 2a 73 74 61 72 74 59 | 20 3d 20 77 72 61 70 42 |.*startY| = wrapB|
|00000a10| 6f 78 2d 3e 74 6f 70 20 | 2b 20 4d 41 58 4f 46 28 |ox->top |+ MAXOF(|
|00000a20| 66 49 6e 66 6f 2e 61 73 | 63 65 6e 74 2c 20 61 73 |fInfo.as|cent, as|
|00000a30| 63 29 3b 0d 09 09 09 2a | 73 74 61 72 74 59 20 2b |c);....*|startY +|
|00000a40| 3d 20 66 49 6e 66 6f 2e | 6c 65 61 64 69 6e 67 3b |= fInfo.|leading;|
|00000a50| 0d 0d 09 09 7d 20 65 6c | 73 65 20 7b 0d 09 09 0d |....} el|se {....|
|00000a60| 09 09 09 2f 2a 0d 09 09 | 09 09 41 74 20 74 68 69 |.../*...|..At thi|
|00000a70| 73 20 70 6f 69 6e 74 20 | 77 65 20 6b 6e 6f 77 20 |s point |we know |
|00000a80| 74 68 65 20 63 75 72 72 | 65 6e 74 20 66 6f 6e 74 |the curr|ent font|
|00000a90| 20 69 73 6e 27 74 20 54 | 72 75 65 54 79 70 65 2c | isn't T|rueType,|
|00000aa0| 20 73 6f 20 77 65 0d 09 | 09 09 09 6a 75 73 74 20 | so we..|...just |
|00000ab0| 75 73 65 20 74 68 65 20 | 6f 6c 64 20 77 61 79 20 |use the |old way |
|00000ac0| 6f 66 20 63 61 6c 63 75 | 6c 61 74 69 6e 67 20 6c |of calcu|lating l|
|00000ad0| 69 6e 65 20 68 65 69 67 | 68 74 2e 0d 09 09 09 2a |ine heig|ht.....*|
|00000ae0| 2f 0d 09 09 09 0d 09 09 | 09 6c 69 6e 65 48 65 69 |/.......|.lineHei|
|00000af0| 67 68 74 20 3d 20 66 49 | 6e 66 6f 2e 61 73 63 65 |ght = fI|nfo.asce|
|00000b00| 6e 74 20 2b 20 66 49 6e | 66 6f 2e 64 65 73 63 65 |nt + fIn|fo.desce|
|00000b10| 6e 74 20 2b 20 66 49 6e | 66 6f 2e 6c 65 61 64 69 |nt + fIn|fo.leadi|
|00000b20| 6e 67 3b 0d 09 09 09 2a | 73 74 61 72 74 59 20 3d |ng;....*|startY =|
|00000b30| 20 77 72 61 70 42 6f 78 | 2d 3e 74 6f 70 20 2b 20 | wrapBox|->top + |
|00000b40| 66 49 6e 66 6f 2e 61 73 | 63 65 6e 74 20 2b 20 66 |fInfo.as|cent + f|
|00000b50| 49 6e 66 6f 2e 6c 65 61 | 64 69 6e 67 3b 0d 09 09 |Info.lea|ding;...|
|00000b60| 7d 0d 0d 09 7d 20 65 6c | 73 65 20 69 66 20 28 6c |}...} el|se if (l|
|00000b70| 68 43 6f 64 65 20 3d 3d | 20 30 29 20 7b 0d 0d 09 |hCode ==| 0) {...|
|00000b80| 09 2f 2a 0d 09 09 09 49 | 66 20 74 68 65 20 75 73 |./*....I|f the us|
|00000b90| 65 72 20 68 61 73 20 73 | 70 65 63 69 66 69 65 64 |er has s|pecified|
|00000ba0| 20 22 64 65 66 61 75 6c | 74 22 20 6c 69 6e 65 20 | "defaul|t" line |
|00000bb0| 68 65 69 67 68 74 2c 20 | 68 65 20 6a 75 73 74 20 |height, |he just |
|00000bc0| 77 61 6e 74 73 20 75 73 | 0d 09 09 09 74 6f 20 67 |wants us|....to g|
|00000bd0| 65 74 20 74 68 65 20 6c | 69 6e 65 20 68 65 69 67 |et the l|ine heig|
|00000be0| 68 74 20 66 72 6f 6d 20 | 74 68 65 20 46 6f 6e 74 |ht from |the Font|
|00000bf0| 49 6e 66 6f 20 72 65 63 | 6f 72 64 2e 0d 09 09 2a |Info rec|ord....*|
|00000c00| 2f 0d 09 09 0d 09 09 6c | 69 6e 65 48 65 69 67 68 |/......l|ineHeigh|
|00000c10| 74 20 3d 20 66 49 6e 66 | 6f 2e 61 73 63 65 6e 74 |t = fInf|o.ascent|
|00000c20| 20 2b 20 66 49 6e 66 6f | 2e 64 65 73 63 65 6e 74 | + fInfo|.descent|
|00000c30| 20 2b 20 66 49 6e 66 6f | 2e 6c 65 61 64 69 6e 67 | + fInfo|.leading|
|00000c40| 3b 0d 09 09 2a 73 74 61 | 72 74 59 20 3d 20 77 72 |;...*sta|rtY = wr|
|00000c50| 61 70 42 6f 78 2d 3e 74 | 6f 70 20 2b 20 66 49 6e |apBox->t|op + fIn|
|00000c60| 66 6f 2e 61 73 63 65 6e | 74 20 2b 20 66 49 6e 66 |fo.ascen|t + fInf|
|00000c70| 6f 2e 6c 65 61 64 69 6e | 67 3b 0d 09 09 0d 09 7d |o.leadin|g;.....}|
|00000c80| 20 65 6c 73 65 20 7b 0d | 09 09 0d 09 09 2f 2a 20 | else {.|...../* |
|00000c90| 49 66 20 74 68 65 20 75 | 73 65 72 20 68 61 73 20 |If the u|ser has |
|00000ca0| 70 72 6f 76 69 64 65 64 | 20 61 20 73 70 65 63 69 |provided| a speci|
|00000cb0| 66 69 63 20 6c 69 6e 65 | 20 68 65 69 67 68 74 2c |fic line| height,|
|00000cc0| 20 77 65 20 6a 75 73 74 | 20 74 72 75 73 74 0d 09 | we just| trust..|
|00000cd0| 09 09 74 68 65 6d 2e 20 | 20 57 65 20 63 61 6e 27 |..them. | We can'|
|00000ce0| 74 20 72 65 61 6c 6c 79 | 20 67 65 6e 65 72 61 74 |t really| generat|
|00000cf0| 65 20 74 6f 6f 20 67 6f | 6f 64 20 6f 66 20 61 20 |e too go|od of a |
|00000d00| 73 74 61 72 74 69 6e 67 | 20 76 65 72 74 69 63 61 |starting| vertica|
|00000d10| 6c 0d 09 09 09 63 6f 6f | 72 64 69 6e 61 74 65 2c |l....coo|rdinate,|
|00000d20| 20 62 75 74 20 77 65 20 | 6d 75 6e 67 65 20 6f 6e | but we |munge on|
|00000d30| 65 20 74 6f 67 65 74 68 | 65 72 20 61 6e 79 77 61 |e togeth|er anywa|
|00000d40| 79 2e 0d 09 09 2a 2f 0d | 0d 09 09 6c 69 6e 65 48 |y....*/.|...lineH|
|00000d50| 65 69 67 68 74 20 3d 20 | 6c 68 43 6f 64 65 3b 0d |eight = |lhCode;.|
|00000d60| 09 09 2a 73 74 61 72 74 | 59 20 3d 20 77 72 61 70 |..*start|Y = wrap|
|00000d70| 42 6f 78 2d 3e 74 6f 70 | 20 2b 20 6c 68 43 6f 64 |Box->top| + lhCod|
|00000d80| 65 20 2b 20 66 49 6e 66 | 6f 2e 6c 65 61 64 69 6e |e + fInf|o.leadin|
|00000d90| 67 3b 0d 0d 09 7d 0d 0d | 09 72 65 74 75 72 6e 28 |g;...}..|.return(|
|00000da0| 6c 69 6e 65 48 65 69 67 | 68 74 29 3b 0d 7d 0d 0d |lineHeig|ht);.}..|
|00000db0| 2f 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |/*******|********|
|00000dc0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000dd0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000de0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000df0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000e00| 2a 0d 2a 0d 2a 20 4e 54 | 42 44 72 61 77 20 2d 20 |*.*.* NT|BDraw - |
|00000e10| 64 72 61 77 73 20 61 20 | 6c 69 6e 65 20 77 69 74 |draws a |line wit|
|00000e20| 68 20 61 70 70 72 6f 70 | 72 69 61 74 65 20 6a 75 |h approp|riate ju|
|00000e30| 73 74 69 66 69 63 61 74 | 69 6f 6e 0d 2a 0d 2a 20 |stificat|ion.*.* |
|00000e40| 49 6e 70 75 74 3a 09 62 | 72 65 61 6b 43 6f 64 65 |Input:.b|reakCode|
|00000e50| 09 74 68 65 20 62 72 65 | 61 6b 20 63 6f 64 65 20 |.the bre|ak code |
|00000e60| 74 68 61 74 20 77 61 73 | 20 72 65 74 75 72 6e 65 |that was| returne|
|00000e70| 64 20 66 72 6f 6d 20 53 | 74 79 6c 65 64 4c 69 6e |d from S|tyledLin|
|00000e80| 65 42 72 65 61 6b 0d 2a | 09 09 09 6c 69 6e 65 53 |eBreak.*|...lineS|
|00000e90| 74 61 72 74 09 70 6f 69 | 6e 74 65 72 20 74 6f 20 |tart.poi|nter to |
|00000ea0| 74 68 65 20 62 65 67 69 | 6e 6e 69 6e 67 20 6f 66 |the begi|nning of|
|00000eb0| 20 74 68 65 20 74 65 78 | 74 20 66 6f 72 20 74 68 | the tex|t for th|
|00000ec0| 65 20 63 75 72 72 65 6e | 74 20 6c 69 6e 65 0d 2a |e curren|t line.*|
|00000ed0| 09 09 09 6c 69 6e 65 42 | 79 74 65 73 09 74 68 65 |...lineB|ytes.the|
|00000ee0| 20 6c 65 6e 67 74 68 20 | 69 6e 20 62 79 74 65 73 | length |in bytes|
|00000ef0| 20 6f 66 20 74 68 65 20 | 74 68 65 20 74 65 78 74 | of the |the text|
|00000f00| 20 66 6f 72 20 74 68 69 | 73 20 6c 69 6e 65 0d 2a | for thi|s line.*|
|00000f10| 09 09 09 77 72 61 70 42 | 6f 78 09 09 74 68 65 20 |...wrapB|ox..the |
|00000f20| 62 6f 78 20 77 69 74 68 | 69 6e 20 77 68 69 63 68 |box with|in which|
|00000f30| 20 77 65 27 72 65 20 77 | 72 61 70 70 69 6e 67 0d | we're w|rapping.|
|00000f40| 2a 09 09 09 61 6c 69 67 | 6e 09 09 74 68 65 20 74 |*...alig|n..the t|
|00000f50| 65 78 74 20 61 6c 69 67 | 6e 6d 65 6e 74 20 61 73 |ext alig|nment as|
|00000f60| 20 73 70 65 63 69 66 69 | 65 64 20 62 79 20 74 68 | specifi|ed by th|
|00000f70| 65 20 75 73 65 72 0d 2a | 09 09 09 63 75 72 59 09 |e user.*|...curY.|
|00000f80| 09 6f 75 72 20 63 75 72 | 72 65 6e 74 20 76 65 72 |.our cur|rent ver|
|00000f90| 74 69 63 61 6c 20 70 65 | 6e 20 63 6f 6f 72 64 69 |tical pe|n coordi|
|00000fa0| 6e 61 74 65 0d 2a 09 09 | 09 62 6f 78 57 69 64 74 |nate.*..|.boxWidt|
|00000fb0| 68 09 74 68 65 20 77 69 | 64 74 68 20 6f 66 20 77 |h.the wi|dth of w|
|00000fc0| 72 61 70 42 6f 78 20 28 | 73 69 6e 63 65 20 4e 65 |rapBox (|since Ne|
|00000fd0| 6f 54 65 78 74 42 6f 78 | 20 61 6c 72 65 61 64 79 |oTextBox| already|
|00000fe0| 20 63 61 6c 63 75 6c 61 | 74 65 64 20 69 74 29 0d | calcula|ted it).|
|00000ff0| 2a 0d 2a 20 4f 75 74 70 | 75 74 3a 09 6e 6f 6e 65 |*.* Outp|ut:.none|
|00001000| 20 28 64 72 61 77 73 20 | 6f 6e 20 74 68 65 20 73 | (draws |on the s|
|00001010| 63 72 65 65 6e 29 0d 2a | 09 09 09 0d 2a 2a 2a 2a |creen).*|....****|
|00001020| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001030| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001040| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001050| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001060| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2f 0d 76 6f |********|****/.vo|
|00001070| 69 64 20 4e 54 42 44 72 | 61 77 28 53 74 79 6c 65 |id NTBDr|aw(Style|
|00001080| 64 4c 69 6e 65 42 72 65 | 61 6b 43 6f 64 65 20 62 |dLineBre|akCode b|
|00001090| 72 65 61 6b 43 6f 64 65 | 2c 20 75 6e 73 69 67 6e |reakCode|, unsign|
|000010a0| 65 64 20 63 68 61 72 20 | 2a 6c 69 6e 65 53 74 61 |ed char |*lineSta|
|000010b0| 72 74 2c 0d 09 6c 6f 6e | 67 20 6c 69 6e 65 42 79 |rt,..lon|g lineBy|
|000010c0| 74 65 73 2c 20 52 65 63 | 74 20 2a 77 72 61 70 42 |tes, Rec|t *wrapB|
|000010d0| 6f 78 2c 20 73 68 6f 72 | 74 20 61 6c 69 67 6e 2c |ox, shor|t align,|
|000010e0| 20 73 68 6f 72 74 20 63 | 75 72 59 2c 20 73 68 6f | short c|urY, sho|
|000010f0| 72 74 20 62 6f 78 57 69 | 64 74 68 29 0d 7b 0d 09 |rt boxWi|dth).{..|
|00001100| 75 6e 73 69 67 6e 65 64 | 20 6c 6f 6e 67 09 62 6c |unsigned| long.bl|
|00001110| 61 63 6b 4c 65 6e 3b 09 | 2f 2a 20 4c 65 6e 67 74 |ackLen;.|/* Lengt|
|00001120| 68 20 6f 66 20 6e 6f 6e | 2d 77 68 69 74 65 20 63 |h of non|-white c|
|00001130| 68 61 72 61 63 74 65 72 | 73 20 2a 2f 0d 09 73 68 |haracter|s */..sh|
|00001140| 6f 72 74 09 09 09 73 6c | 6f 70 3b 09 09 2f 2a 20 |ort...sl|op;../* |
|00001150| 4e 75 6d 62 65 72 20 6f | 66 20 70 69 78 65 6c 73 |Number o|f pixels|
|00001160| 20 6f 66 20 73 6c 6f 70 | 20 66 6f 72 20 66 75 6c | of slop| for ful|
|00001170| 6c 20 6a 75 73 74 20 2a | 2f 0d 0d 09 2f 2a 0d 09 |l just *|/.../*..|
|00001180| 09 54 68 65 20 66 69 72 | 73 74 20 74 68 69 6e 67 |.The fir|st thing|
|00001190| 20 77 65 20 64 6f 20 68 | 65 72 65 20 69 73 20 64 | we do h|ere is d|
|000011a0| 65 74 65 72 6d 69 6e 65 | 20 74 68 65 20 6c 65 6e |etermine| the len|
|000011b0| 67 74 68 20 6f 66 20 74 | 68 65 20 22 62 6c 61 63 |gth of t|he "blac|
|000011c0| 6b 22 20 70 61 72 74 0d | 09 09 6f 66 20 74 68 65 |k" part.|..of the|
|000011d0| 20 63 75 72 72 65 6e 74 | 20 6c 69 6e 65 2e 20 20 | current| line. |
|000011e0| 54 68 69 73 20 65 78 63 | 6c 75 64 65 73 20 73 70 |This exc|ludes sp|
|000011f0| 61 63 65 73 2c 20 63 61 | 72 72 69 61 67 65 20 72 |aces, ca|rriage r|
|00001200| 65 74 75 72 6e 73 2c 20 | 61 6e 64 20 6f 74 68 65 |eturns, |and othe|
|00001210| 72 0d 09 09 77 68 69 74 | 65 20 73 74 75 66 66 20 |r...whit|e stuff |
|00001220| 64 65 70 65 6e 64 69 6e | 67 20 6f 6e 20 74 68 65 |dependin|g on the|
|00001230| 20 6c 61 6e 67 75 61 67 | 65 2e 20 20 48 6f 77 20 | languag|e. How |
|00001240| 64 6f 20 77 65 20 6b 6e | 6f 77 20 77 68 61 74 20 |do we kn|ow what |
|00001250| 74 6f 20 65 6c 69 6d 2d | 0d 09 09 69 6e 61 74 65 |to elim-|...inate|
|00001260| 3f 20 20 57 65 20 44 4f | 4e 27 54 21 20 20 53 6f |? We DO|N'T! So|
|00001270| 20 77 65 20 61 73 6b 20 | 6f 75 72 20 66 72 69 65 | we ask |our frie|
|00001280| 6e 64 20 74 68 65 20 53 | 63 72 69 70 74 20 4d 61 |nd the S|cript Ma|
|00001290| 6e 61 67 65 72 20 74 6f | 20 64 6f 20 69 74 0d 09 |nager to| do it..|
|000012a0| 09 66 6f 72 20 75 73 2e | 20 20 56 69 73 69 62 6c |.for us.| Visibl|
|000012b0| 65 4c 65 6e 67 74 68 20 | 72 65 74 75 72 6e 73 20 |eLength |returns |
|000012c0| 74 68 65 20 6e 75 6d 62 | 65 72 20 6f 66 20 62 79 |the numb|er of by|
|000012d0| 74 65 73 20 74 68 61 74 | 20 77 65 20 73 68 6f 75 |tes that| we shou|
|000012e0| 6c 64 20 75 73 65 0d 09 | 09 66 6f 72 20 70 69 78 |ld use..|.for pix|
|000012f0| 65 6c 20 77 69 64 74 68 | 20 63 61 6c 63 75 6c 61 |el width| calcula|
|00001300| 74 69 6f 6e 73 2e 0d 09 | 2a 2f 0d 09 0d 09 62 6c |tions...|*/....bl|
|00001310| 61 63 6b 4c 65 6e 20 3d | 20 56 69 73 69 62 6c 65 |ackLen =| Visible|
|00001320| 4c 65 6e 67 74 68 28 6c | 69 6e 65 53 74 61 72 74 |Length(l|ineStart|
|00001330| 2c 20 6c 69 6e 65 42 79 | 74 65 73 29 3b 0d 09 0d |, lineBy|tes);...|
|00001340| 09 69 66 20 28 61 6c 69 | 67 6e 20 3d 3d 20 6e 74 |.if (ali|gn == nt|
|00001350| 62 4a 75 73 74 46 75 6c | 6c 29 20 7b 0d 09 0d 09 |bJustFul|l) {....|
|00001360| 09 2f 2a 0d 09 09 09 46 | 6f 72 20 66 75 6c 6c 20 |./*....F|or full |
|00001370| 6a 75 73 74 69 66 69 63 | 61 74 69 6f 6e 2c 20 77 |justific|ation, w|
|00001380| 65 20 6e 65 65 64 20 74 | 6f 20 63 61 6c 63 75 6c |e need t|o calcul|
|00001390| 61 74 65 20 74 68 65 20 | 22 73 6c 6f 70 22 20 73 |ate the |"slop" s|
|000013a0| 70 61 63 65 20 6f 6e 0d | 09 09 09 74 68 65 20 6c |pace on.|...the l|
|000013b0| 69 6e 65 20 74 68 61 74 | 27 73 20 6e 6f 74 20 66 |ine that|'s not f|
|000013c0| 69 6c 6c 65 64 20 75 70 | 20 62 79 20 74 68 65 20 |illed up| by the |
|000013d0| 74 65 78 74 2e 20 20 54 | 68 65 6e 20 77 65 20 6d |text. T|hen we m|
|000013e0| 6f 76 65 20 74 6f 20 74 | 68 65 0d 09 09 09 6d 61 |ove to t|he....ma|
|000013f0| 72 67 69 6e 20 61 6e 64 | 20 67 65 74 20 72 65 61 |rgin and| get rea|
|00001400| 64 79 20 74 6f 20 64 72 | 61 77 20 42 55 54 20 57 |dy to dr|aw BUT W|
|00001410| 41 49 54 21 20 20 49 66 | 20 74 68 69 73 20 69 73 |AIT! If| this is|
|00001420| 20 74 68 65 20 6c 61 73 | 74 20 6c 69 6e 65 20 6f | the las|t line o|
|00001430| 66 0d 09 09 09 61 20 70 | 61 72 61 67 72 61 70 68 |f....a p|aragraph|
|00001440| 2c 20 77 65 20 6e 65 65 | 64 20 74 6f 20 64 72 61 |, we nee|d to dra|
|00001450| 77 20 69 74 20 77 69 74 | 68 20 77 68 61 74 65 76 |w it wit|h whatev|
|00001460| 65 72 20 74 68 65 20 73 | 79 73 74 65 6d 20 6a 75 |er the s|ystem ju|
|00001470| 73 74 69 66 69 2d 0d 09 | 09 09 63 61 74 69 6f 6e |stifi-..|..cation|
|00001480| 20 69 73 2e 20 20 53 6f | 20 69 66 20 74 68 65 20 | is. So| if the |
|00001490| 62 72 65 61 6b 20 63 6f | 64 65 20 69 6e 64 69 63 |break co|de indic|
|000014a0| 61 74 65 73 20 77 65 27 | 72 65 20 61 74 20 74 68 |ates we'|re at th|
|000014b0| 65 20 65 6e 64 20 6f 66 | 20 74 68 65 0d 09 09 09 |e end of| the....|
|000014c0| 74 65 78 74 2c 20 6f 72 | 20 77 65 20 63 61 6e 20 |text, or| we can |
|000014d0| 66 69 6e 64 20 61 20 63 | 61 72 72 69 61 67 65 20 |find a c|arriage |
|000014e0| 72 65 74 75 72 6e 20 74 | 68 65 72 65 20 6f 75 72 |return t|here our|
|000014f0| 73 65 6c 76 65 73 2c 20 | 77 65 20 6a 75 73 74 0d |selves, |we just.|
|00001500| 09 09 09 63 68 61 6e 67 | 65 20 74 68 65 20 74 65 |...chang|e the te|
|00001510| 78 74 20 61 6c 69 67 6e | 6d 65 6e 74 20 74 6f 20 |xt align|ment to |
|00001520| 74 68 65 20 63 75 72 72 | 65 6e 74 20 64 65 66 61 |the curr|ent defa|
|00001530| 75 6c 74 20 73 79 73 74 | 65 6d 20 74 65 78 74 20 |ult syst|em text |
|00001540| 61 6c 69 67 6e 2d 0d 09 | 09 09 6d 65 6e 74 20 61 |align-..|..ment a|
|00001550| 6e 64 20 66 61 6c 6c 20 | 74 68 72 6f 75 67 68 20 |nd fall |through |
|00001560| 77 69 74 68 6f 75 74 20 | 64 72 61 77 69 6e 67 2e |without |drawing.|
|00001570| 20 20 49 66 20 69 74 27 | 73 20 6a 75 73 74 20 61 | If it'|s just a|
|00001580| 6e 6f 74 68 65 72 20 6c | 69 6e 65 0d 09 09 09 77 |nother l|ine....w|
|00001590| 69 74 68 69 6e 20 61 20 | 70 61 72 61 67 72 61 70 |ithin a |paragrap|
|000015a0| 68 2c 20 77 65 20 75 73 | 65 20 74 68 65 20 68 61 |h, we us|e the ha|
|000015b0| 6e 64 79 20 53 63 72 69 | 70 74 20 4d 61 6e 61 67 |ndy Scri|pt Manag|
|000015c0| 65 72 20 72 6f 75 74 69 | 6e 65 20 44 72 61 77 4a |er routi|ne DrawJ|
|000015d0| 75 73 74 0d 09 09 09 74 | 6f 20 64 72 61 77 20 69 |ust....t|o draw i|
|000015e0| 74 20 6a 75 73 74 69 66 | 69 65 64 2e 20 20 49 6e |t justif|ied. In|
|000015f0| 20 6c 61 6e 67 75 61 67 | 65 73 20 6c 69 6b 65 20 | languag|es like |
|00001600| 41 72 61 62 69 63 2c 20 | 66 75 6c 6c 20 6a 75 73 |Arabic, |full jus|
|00001610| 74 69 66 69 63 61 74 69 | 6f 6e 0d 09 09 09 69 73 |tificati|on....is|
|00001620| 20 70 65 72 66 6f 72 6d | 65 64 20 64 69 66 66 65 | perform|ed diffe|
|00001630| 72 65 6e 74 6c 79 20 74 | 68 61 6e 20 6a 75 73 74 |rently t|han just|
|00001640| 20 73 70 61 63 69 6e 67 | 20 6f 75 74 20 74 68 65 | spacing| out the|
|00001650| 20 77 6f 72 64 73 2e 20 | 20 44 72 61 77 4a 75 73 | words. | DrawJus|
|00001660| 74 0d 09 09 09 68 61 6e | 64 6c 65 73 20 63 61 73 |t....han|dles cas|
|00001670| 65 73 20 6c 69 6b 65 20 | 74 68 65 73 65 20 63 6f |es like |these co|
|00001680| 72 72 65 63 74 6c 79 2e | 0d 09 09 09 0d 09 09 09 |rrectly.|........|
|00001690| 4e 6f 74 65 20 74 68 61 | 74 20 77 68 65 6e 20 77 |Note tha|t when w|
|000016a0| 65 20 67 6f 20 6c 6f 6f | 6b 69 6e 67 20 66 6f 72 |e go loo|king for|
|000016b0| 20 74 68 65 20 63 61 72 | 72 69 61 67 65 20 72 65 | the car|riage re|
|000016c0| 74 75 72 6e 20 61 74 20 | 74 68 65 20 65 6e 64 20 |turn at |the end |
|000016d0| 6f 66 0d 09 09 09 74 68 | 65 20 6c 69 6e 65 2c 20 |of....th|e line, |
|000016e0| 69 74 27 73 20 6f 6b 61 | 79 20 74 6f 20 73 69 6d |it's oka|y to sim|
|000016f0| 70 6c 79 20 69 6e 64 65 | 78 20 74 6f 20 74 68 65 |ply inde|x to the|
|00001700| 20 6c 61 73 74 20 62 79 | 74 65 20 6f 66 20 74 68 | last by|te of th|
|00001710| 65 20 73 74 72 69 6e 67 | 2e 0d 09 09 09 54 68 69 |e string|.....Thi|
|00001720| 73 20 69 73 20 62 65 63 | 61 75 73 65 20 74 68 65 |s is bec|ause the|
|00001730| 20 63 61 72 72 69 61 67 | 65 20 72 65 74 75 72 6e | carriag|e return|
|00001740| 20 63 68 61 72 61 63 74 | 65 72 2c 20 30 78 30 64 | charact|er, 0x0d|
|00001750| 2c 20 69 73 20 69 6e 20 | 74 68 65 0d 09 09 09 63 |, is in |the....c|
|00001760| 6f 6e 74 72 6f 6c 2d 63 | 6f 64 65 20 72 61 6e 67 |ontrol-c|ode rang|
|00001770| 65 2c 20 77 68 69 63 68 | 20 69 73 20 64 65 66 69 |e, which| is defi|
|00001780| 6e 65 64 20 74 6f 20 6e | 65 76 65 72 20 62 65 20 |ned to n|ever be |
|00001790| 74 68 65 20 6c 6f 77 20 | 62 79 74 65 20 6f 66 20 |the low |byte of |
|000017a0| 61 0d 09 09 09 74 77 6f | 20 62 79 74 65 20 63 68 |a....two| byte ch|
|000017b0| 61 72 61 63 74 65 72 2e | 0d 09 09 2a 2f 0d 0d 09 |aracter.|...*/...|
|000017c0| 09 73 6c 6f 70 20 3d 20 | 62 6f 78 57 69 64 74 68 |.slop = |boxWidth|
|000017d0| 20 2d 20 54 65 78 74 57 | 69 64 74 68 28 6c 69 6e | - TextW|idth(lin|
|000017e0| 65 53 74 61 72 74 2c 20 | 30 2c 20 62 6c 61 63 6b |eStart, |0, black|
|000017f0| 4c 65 6e 29 3b 0d 09 09 | 4d 6f 76 65 54 6f 28 77 |Len);...|MoveTo(w|
|00001800| 72 61 70 42 6f 78 2d 3e | 6c 65 66 74 2c 20 63 75 |rapBox->|left, cu|
|00001810| 72 59 29 3b 0d 09 09 69 | 66 20 28 62 72 65 61 6b |rY);...i|f (break|
|00001820| 43 6f 64 65 20 3d 3d 20 | 73 6d 42 72 65 61 6b 4f |Code == |smBreakO|
|00001830| 76 65 72 66 6c 6f 77 20 | 7c 7c 0d 09 09 09 2a 28 |verflow |||....*(|
|00001840| 6c 69 6e 65 53 74 61 72 | 74 20 2b 20 28 6c 69 6e |lineStar|t + (lin|
|00001850| 65 42 79 74 65 73 20 2d | 20 31 29 29 20 3d 3d 20 |eBytes -| 1)) == |
|00001860| 6b 52 65 74 75 72 6e 43 | 68 61 72 29 0d 09 09 09 |kReturnC|har)....|
|00001870| 61 6c 69 67 6e 20 3d 20 | 47 65 74 53 79 73 4a 75 |align = |GetSysJu|
|00001880| 73 74 28 29 3b 0d 09 09 | 65 6c 73 65 20 44 72 61 |st();...|else Dra|
|00001890| 77 4a 75 73 74 28 6c 69 | 6e 65 53 74 61 72 74 2c |wJust(li|neStart,|
|000018a0| 20 62 6c 61 63 6b 4c 65 | 6e 2c 20 73 6c 6f 70 29 | blackLe|n, slop)|
|000018b0| 3b 0d 09 7d 0d 0d 09 2f | 2a 0d 09 09 46 6f 72 20 |;..}.../|*...For |
|000018c0| 74 68 65 20 72 65 73 74 | 20 6f 66 20 74 68 65 20 |the rest| of the |
|000018d0| 74 65 78 74 20 61 6c 69 | 67 6e 6d 65 6e 74 73 20 |text ali|gnments |
|000018e0| 28 6c 65 66 74 2c 20 63 | 65 6e 74 65 72 2c 20 61 |(left, c|enter, a|
|000018f0| 6e 64 20 72 69 67 68 74 | 29 2c 20 77 65 20 6a 75 |nd right|), we ju|
|00001900| 73 74 0d 09 09 6d 6f 76 | 65 20 74 68 65 20 70 65 |st...mov|e the pe|
|00001910| 6e 20 74 6f 20 74 68 65 | 20 72 69 67 68 74 20 70 |n to the| right p|
|00001920| 6c 61 63 65 20 61 6e 64 | 20 64 72 61 77 20 74 68 |lace and| draw th|
|00001930| 65 20 74 65 78 74 20 77 | 69 74 68 20 44 72 61 77 |e text w|ith Draw|
|00001940| 54 65 78 74 2e 20 20 4e | 6f 74 65 0d 09 09 74 68 |Text. N|ote...th|
|00001950| 61 74 20 74 68 65 20 61 | 6c 69 67 6e 6d 65 6e 74 |at the a|lignment|
|00001960| 73 20 74 68 61 74 20 63 | 6f 75 6c 64 20 68 61 76 |s that c|ould hav|
|00001970| 65 20 63 6f 6d 65 20 69 | 6e 74 6f 20 74 68 65 20 |e come i|nto the |
|00001980| 4e 65 6f 54 65 78 74 42 | 6f 78 20 63 61 6c 6c 20 |NeoTextB|ox call |
|00001990| 68 61 76 65 0d 09 09 62 | 65 65 6e 20 72 65 73 6f |have...b|een reso|
|000019a0| 76 65 64 20 64 6f 77 6e | 20 74 6f 20 6f 6e 65 20 |ved down| to one |
|000019b0| 6f 66 20 74 68 65 20 66 | 6f 75 72 20 63 6f 6e 73 |of the f|our cons|
|000019c0| 74 61 6e 74 73 20 74 65 | 46 6f 72 63 65 4c 65 66 |tants te|ForceLef|
|000019d0| 74 2c 20 74 65 4a 75 73 | 74 52 69 67 68 74 0d 09 |t, teJus|tRight..|
|000019e0| 09 74 65 4a 75 73 74 43 | 65 6e 74 65 72 2c 20 6f |.teJustC|enter, o|
|000019f0| 72 20 6e 74 62 4a 75 73 | 74 46 75 6c 6c 2e 0d 09 |r ntbJus|tFull...|
|00001a00| 2a 2f 0d 09 0d 09 73 77 | 69 74 63 68 28 61 6c 69 |*/....sw|itch(ali|
|00001a10| 67 6e 29 20 7b 0d 09 09 | 63 61 73 65 20 74 65 46 |gn) {...|case teF|
|00001a20| 6f 72 63 65 4c 65 66 74 | 3a 0d 09 09 63 61 73 65 |orceLeft|:...case|
|00001a30| 20 74 65 4a 75 73 74 4c | 65 66 74 3a 0d 09 09 09 | teJustL|eft:....|
|00001a40| 4d 6f 76 65 54 6f 28 77 | 72 61 70 42 6f 78 2d 3e |MoveTo(w|rapBox->|
|00001a50| 6c 65 66 74 2c 20 63 75 | 72 59 29 3b 0d 09 09 09 |left, cu|rY);....|
|00001a60| 62 72 65 61 6b 3b 0d 09 | 09 63 61 73 65 20 74 65 |break;..|.case te|
|00001a70| 4a 75 73 74 52 69 67 68 | 74 3a 0d 09 09 09 4d 6f |JustRigh|t:....Mo|
|00001a80| 76 65 54 6f 28 77 72 61 | 70 42 6f 78 2d 3e 72 69 |veTo(wra|pBox->ri|
|00001a90| 67 68 74 20 2d 20 54 65 | 78 74 57 69 64 74 68 28 |ght - Te|xtWidth(|
|00001aa0| 6c 69 6e 65 53 74 61 72 | 74 2c 20 30 2c 20 62 6c |lineStar|t, 0, bl|
|00001ab0| 61 63 6b 4c 65 6e 29 2c | 20 63 75 72 59 29 3b 0d |ackLen),| curY);.|
|00001ac0| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 63 61 73 65 |...break|;...case|
|00001ad0| 20 74 65 4a 75 73 74 43 | 65 6e 74 65 72 3a 0d 09 | teJustC|enter:..|
|00001ae0| 09 09 4d 6f 76 65 54 6f | 28 77 72 61 70 42 6f 78 |..MoveTo|(wrapBox|
|00001af0| 2d 3e 6c 65 66 74 20 2b | 20 28 62 6f 78 57 69 64 |->left +| (boxWid|
|00001b00| 74 68 20 2d 20 54 65 78 | 74 57 69 64 74 68 28 6c |th - Tex|tWidth(l|
|00001b10| 69 6e 65 53 74 61 72 74 | 2c 20 30 2c 20 62 6c 61 |ineStart|, 0, bla|
|00001b20| 63 6b 4c 65 6e 29 29 20 | 2f 20 32 2c 0d 09 09 09 |ckLen)) |/ 2,....|
|00001b30| 09 63 75 72 59 29 3b 0d | 09 09 09 62 72 65 61 6b |.curY);.|...break|
|00001b40| 3b 0d 09 7d 0d 09 69 66 | 20 28 61 6c 69 67 6e 20 |;..}..if| (align |
|00001b50| 21 3d 20 6e 74 62 4a 75 | 73 74 46 75 6c 6c 29 0d |!= ntbJu|stFull).|
|00001b60| 09 09 44 72 61 77 54 65 | 78 74 28 6c 69 6e 65 53 |..DrawTe|xt(lineS|
|00001b70| 74 61 72 74 2c 20 30 2c | 20 6c 69 6e 65 42 79 74 |tart, 0,| lineByt|
|00001b80| 65 73 29 3b 0d 7d 0d 0d | 2f 2a 2a 2a 2a 2a 2a 2a |es);.}..|/*******|
|00001b90| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001ba0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001bb0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001bc0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001bd0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 0d 2a 0d 2a 20 4e 65 |********|*.*.* Ne|
|00001be0| 6f 54 65 78 74 42 6f 78 | 20 2d 20 77 6f 72 64 2d |oTextBox| - word-|
|00001bf0| 77 72 61 70 73 20 74 65 | 78 74 20 69 6e 73 69 64 |wraps te|xt insid|
|00001c00| 65 20 61 20 67 69 76 65 | 6e 20 62 6f 78 0d 2a 0d |e a give|n box.*.|
|00001c10| 2a 20 49 6e 70 75 74 3a | 09 74 68 65 54 65 78 74 |* Input:|.theText|
|00001c20| 09 09 74 68 65 20 74 65 | 78 74 20 77 65 20 6e 65 |..the te|xt we ne|
|00001c30| 65 64 20 74 6f 20 77 72 | 61 70 0d 2a 09 09 09 74 |ed to wr|ap.*...t|
|00001c40| 65 78 74 4c 65 6e 09 09 | 74 68 65 20 6c 65 6e 67 |extLen..|the leng|
|00001c50| 74 68 20 69 6e 20 62 79 | 74 65 73 20 6f 66 20 74 |th in by|tes of t|
|00001c60| 68 65 20 74 65 78 74 0d | 2a 09 09 09 77 72 61 70 |he text.|*...wrap|
|00001c70| 42 6f 78 09 09 74 68 65 | 20 62 6f 78 20 77 69 74 |Box..the| box wit|
|00001c80| 68 69 6e 20 77 68 69 63 | 68 20 77 65 27 72 65 20 |hin whic|h we're |
|00001c90| 77 72 61 70 70 69 6e 67 | 0d 2a 09 09 09 61 6c 69 |wrapping|.*...ali|
|00001ca0| 67 6e 09 09 74 68 65 20 | 74 65 78 74 20 61 6c 69 |gn..the |text ali|
|00001cb0| 67 6e 6d 65 6e 74 0d 2a | 09 09 09 09 09 09 09 74 |gnment.*|.......t|
|00001cc0| 65 46 6f 72 63 65 4c 65 | 66 74 2c 20 74 65 46 6c |eForceLe|ft, teFl|
|00001cd0| 75 73 68 4c 65 66 74 09 | 6c 65 66 74 20 6a 75 73 |ushLeft.|left jus|
|00001ce0| 74 69 66 69 65 64 0d 2a | 09 09 09 09 09 09 09 74 |tified.*|.......t|
|00001cf0| 65 4a 75 73 74 43 65 6e | 74 65 72 2c 20 74 65 43 |eJustCen|ter, teC|
|00001d00| 65 6e 74 65 72 09 09 63 | 65 6e 74 65 72 20 6a 75 |enter..c|enter ju|
|00001d10| 73 74 69 66 69 65 64 0d | 2a 09 09 09 09 09 09 09 |stified.|*.......|
|00001d20| 74 65 4a 75 73 74 52 69 | 67 68 74 2c 20 74 65 46 |teJustRi|ght, teF|
|00001d30| 6c 75 73 68 52 69 67 68 | 74 09 72 69 67 68 74 20 |lushRigh|t.right |
|00001d40| 6a 75 73 74 69 66 69 65 | 64 0d 2a 09 09 09 09 09 |justifie|d.*.....|
|00001d50| 09 09 6e 74 62 4a 75 73 | 74 46 75 6c 6c 09 09 09 |..ntbJus|tFull...|
|00001d60| 09 09 66 75 6c 6c 20 6a | 75 73 74 69 66 69 65 64 |..full j|ustified|
|00001d70| 0d 2a 09 09 09 09 09 09 | 09 74 65 4a 75 73 74 4c |.*......|.teJustL|
|00001d80| 65 66 74 2c 20 74 65 46 | 6c 75 73 68 44 65 66 61 |eft, teF|lushDefa|
|00001d90| 75 6c 74 09 73 79 73 74 | 65 6d 20 6a 75 73 74 69 |ult.syst|em justi|
|00001da0| 66 69 65 64 0d 2a 09 09 | 09 6c 68 43 6f 64 65 09 |fied.*..|.lhCode.|
|00001db0| 09 74 68 65 20 6c 69 6e | 65 20 68 65 69 67 68 74 |.the lin|e height|
|00001dc0| 20 63 6f 64 65 20 74 68 | 61 74 20 77 61 73 20 70 | code th|at was p|
|00001dd0| 61 73 73 65 64 20 74 6f | 20 4e 65 6f 54 65 78 74 |assed to| NeoText|
|00001de0| 42 6f 78 0d 2a 09 09 09 | 09 09 09 09 3c 20 30 09 |Box.*...|....< 0.|
|00001df0| 09 76 61 72 69 61 62 6c | 65 20 2d 20 62 61 73 65 |.variabl|e - base|
|00001e00| 64 20 6f 6e 20 74 61 6c | 6c 65 73 74 20 63 68 61 |d on tal|lest cha|
|00001e10| 72 61 63 74 65 72 0d 2a | 09 09 09 09 09 09 09 30 |racter.*|.......0|
|00001e20| 09 09 64 65 66 61 75 6c | 74 20 2d 20 62 61 73 65 |..defaul|t - base|
|00001e30| 64 20 6f 6e 20 47 65 74 | 46 6f 6e 74 49 6e 66 6f |d on Get|FontInfo|
|00001e40| 0d 2a 09 09 09 09 09 09 | 09 3e 20 30 09 09 66 69 |.*......|.> 0..fi|
|00001e50| 78 65 64 20 2d 20 75 73 | 65 20 6c 68 43 6f 64 65 |xed - us|e lhCode|
|00001e60| 20 61 73 20 74 68 65 20 | 6c 69 6e 65 20 68 65 69 | as the |line hei|
|00001e70| 67 68 74 0d 2a 09 09 09 | 65 6e 64 59 09 09 56 41 |ght.*...|endY..VA|
|00001e80| 52 20 2d 20 69 66 20 6e | 6f 6e 2d 6e 69 6c 2c 20 |R - if n|on-nil, |
|00001e90| 74 68 65 20 76 65 72 74 | 69 63 61 6c 20 63 6f 6f |the vert|ical coo|
|00001ea0| 72 64 20 6f 66 20 74 68 | 65 20 6c 61 73 74 20 6c |rd of th|e last l|
|00001eb0| 69 6e 65 0d 2a 09 09 09 | 6c 68 55 73 65 64 09 09 |ine.*...|lhUsed..|
|00001ec0| 56 41 52 20 2d 20 69 66 | 20 6e 6f 6e 2d 6e 69 6c |VAR - if| non-nil|
|00001ed0| 2c 20 74 68 65 20 6c 69 | 6e 65 20 68 65 69 67 68 |, the li|ne heigh|
|00001ee0| 74 20 75 73 65 64 20 74 | 6f 20 64 72 61 77 20 74 |t used t|o draw t|
|00001ef0| 68 65 20 74 65 78 74 0d | 2a 0d 2a 20 4f 75 74 70 |he text.|*.* Outp|
|00001f00| 75 74 3a 09 72 65 74 75 | 72 6e 73 20 74 68 65 20 |ut:.retu|rns the |
|00001f10| 6e 75 6d 62 65 72 20 6f | 66 20 6c 69 6e 65 20 64 |number o|f line d|
|00001f20| 72 61 77 6e 20 74 6f 74 | 61 6c 20 28 65 76 65 6e |rawn tot|al (even|
|00001f30| 20 69 66 20 74 68 65 79 | 20 64 72 65 77 20 6f 75 | if they| drew ou|
|00001f40| 74 73 69 64 65 20 6f 66 | 0d 2a 09 09 09 74 68 65 |tside of|.*...the|
|00001f50| 20 62 6f 75 6e 64 72 69 | 65 73 20 6f 66 20 77 72 | boundri|es of wr|
|00001f60| 61 70 42 6f 78 29 0d 2a | 09 09 09 0d 2a 2a 2a 2a |apBox).*|....****|
|00001f70| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001f80| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001f90| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001fa0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001fb0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2f 0d 73 68 |********|****/.sh|
|00001fc0| 6f 72 74 20 4e 65 6f 54 | 65 78 74 42 6f 78 28 75 |ort NeoT|extBox(u|
|00001fd0| 6e 73 69 67 6e 65 64 20 | 63 68 61 72 20 2a 74 68 |nsigned |char *th|
|00001fe0| 65 54 65 78 74 2c 20 75 | 6e 73 69 67 6e 65 64 20 |eText, u|nsigned |
|00001ff0| 6c 6f 6e 67 20 74 65 78 | 74 4c 65 6e 2c 20 52 65 |long tex|tLen, Re|
|00002000| 63 74 20 2a 77 72 61 70 | 42 6f 78 2c 0d 09 73 68 |ct *wrap|Box,..sh|
|00002010| 6f 72 74 20 61 6c 69 67 | 6e 2c 20 73 68 6f 72 74 |ort alig|n, short|
|00002020| 20 6c 68 43 6f 64 65 2c | 20 73 68 6f 72 74 20 2a | lhCode,| short *|
|00002030| 65 6e 64 59 2c 20 73 68 | 6f 72 74 20 2a 6c 68 55 |endY, sh|ort *lhU|
|00002040| 73 65 64 29 0d 7b 0d 09 | 52 67 6e 48 61 6e 64 6c |sed).{..|RgnHandl|
|00002050| 65 09 09 09 6f 6c 64 43 | 6c 69 70 3b 09 09 2f 2a |e...oldC|lip;../*|
|00002060| 20 53 61 76 65 64 20 63 | 6c 69 70 70 69 6e 67 20 | Saved c|lipping |
|00002070| 72 65 67 69 6f 6e 20 2a | 2f 0d 09 53 74 79 6c 65 |region *|/..Style|
|00002080| 64 4c 69 6e 65 42 72 65 | 61 6b 43 6f 64 65 09 62 |dLineBre|akCode.b|
|00002090| 72 65 61 6b 43 6f 64 65 | 3b 09 09 2f 2a 20 52 65 |reakCode|;../* Re|
|000020a0| 74 75 72 6e 65 64 20 63 | 6f 64 65 20 66 72 6f 6d |turned c|ode from|
|000020b0| 20 53 74 79 6c 65 64 4c | 69 6e 65 42 72 65 61 6b | StyledL|ineBreak|
|000020c0| 20 2a 2f 0d 09 46 69 78 | 65 64 09 09 09 09 66 69 | */..Fix|ed....fi|
|000020d0| 78 65 64 4d 61 78 3b 09 | 09 2f 2a 20 62 6f 78 57 |xedMax;.|./* boxW|
|000020e0| 69 64 74 68 20 63 6f 6e | 76 65 72 74 65 64 20 74 |idth con|verted t|
|000020f0| 6f 20 66 69 78 65 64 20 | 70 6f 69 6e 74 20 2a 2f |o fixed |point */|
|00002100| 0d 09 46 69 78 65 64 09 | 09 09 09 77 72 61 70 57 |..Fixed.|...wrapW|
|00002110| 69 64 3b 09 09 2f 2a 20 | 57 69 64 74 68 20 74 6f |id;../* |Width to|
|00002120| 20 77 72 61 70 20 74 6f | 20 2a 2f 0d 09 73 68 6f | wrap to| */..sho|
|00002130| 72 74 09 09 09 09 62 6f | 78 57 69 64 74 68 3b 09 |rt....bo|xWidth;.|
|00002140| 09 2f 2a 20 57 69 64 74 | 68 20 6f 66 20 74 68 65 |./* Widt|h of the|
|00002150| 20 77 72 61 70 42 6f 78 | 20 2a 2f 0d 09 6c 6f 6e | wrapBox| */..lon|
|00002160| 67 09 09 09 09 6c 69 6e | 65 42 79 74 65 73 3b 09 |g....lin|eBytes;.|
|00002170| 09 2f 2a 20 4e 75 6d 62 | 65 72 20 6f 66 20 62 79 |./* Numb|er of by|
|00002180| 74 65 73 20 69 6e 20 6f | 6e 65 20 6c 69 6e 65 20 |tes in o|ne line |
|00002190| 2a 2f 0d 09 75 6e 73 69 | 67 6e 65 64 20 73 68 6f |*/..unsi|gned sho|
|000021a0| 72 74 09 09 6c 69 6e 65 | 48 65 69 67 68 74 3b 09 |rt..line|Height;.|
|000021b0| 09 2f 2a 20 43 61 6c 63 | 75 6c 61 74 65 64 20 6c |./* Calc|ulated l|
|000021c0| 69 6e 65 20 68 65 69 67 | 68 74 20 2a 2f 0d 09 73 |ine heig|ht */..s|
|000021d0| 68 6f 72 74 09 09 09 09 | 63 75 72 59 3b 09 09 09 |hort....|curY;...|
|000021e0| 2f 2a 20 43 75 72 72 65 | 6e 74 20 76 65 72 74 69 |/* Curre|nt verti|
|000021f0| 63 61 6c 20 70 65 6e 20 | 6c 6f 63 61 74 69 6f 6e |cal pen |location|
|00002200| 20 2a 2f 0d 09 75 6e 73 | 69 67 6e 65 64 20 73 68 | */..uns|igned sh|
|00002210| 6f 72 74 09 09 6c 69 6e | 65 43 6f 75 6e 74 3b 09 |ort..lin|eCount;.|
|00002220| 09 2f 2a 20 4e 75 6d 62 | 65 72 20 6f 66 20 6c 69 |./* Numb|er of li|
|00002230| 6e 65 73 20 77 65 27 76 | 65 20 64 72 61 77 6e 20 |nes we'v|e drawn |
|00002240| 2a 2f 0d 09 6c 6f 6e 67 | 09 09 09 09 74 65 78 74 |*/..long|....text|
|00002250| 4c 65 66 74 3b 09 09 2f | 2a 20 50 6f 69 6e 74 65 |Left;../|* Pointe|
|00002260| 72 20 74 6f 20 72 65 6d | 61 69 6e 69 6e 67 20 62 |r to rem|aining b|
|00002270| 79 74 65 73 20 6f 66 20 | 74 65 78 74 20 2a 2f 0d |ytes of |text */.|
|00002280| 09 75 6e 73 69 67 6e 65 | 64 20 63 68 61 72 09 09 |.unsigne|d char..|
|00002290| 2a 6c 69 6e 65 53 74 61 | 72 74 3b 09 09 2f 2a 20 |*lineSta|rt;../* |
|000022a0| 50 6f 69 6e 74 65 72 20 | 74 6f 20 62 65 67 69 6e |Pointer |to begin|
|000022b0| 6e 69 6e 67 20 6f 66 20 | 61 20 6c 69 6e 65 20 2a |ning of |a line *|
|000022c0| 2f 0d 09 75 6e 73 69 67 | 6e 65 64 20 63 68 61 72 |/..unsig|ned char|
|000022d0| 09 09 2a 74 65 78 74 45 | 6e 64 3b 09 09 2f 2a 20 |..*textE|nd;../* |
|000022e0| 50 6f 69 6e 74 65 72 20 | 74 6f 20 74 68 65 20 65 |Pointer |to the e|
|000022f0| 6e 64 20 6f 66 20 69 6e | 70 75 74 20 74 65 78 74 |nd of in|put text|
|00002300| 20 2a 2f 0d 0d 09 2f 2a | 0d 09 09 46 69 72 73 74 | */.../*|...First|
|00002310| 2c 20 77 65 20 73 61 76 | 65 20 74 68 65 20 6f 6c |, we sav|e the ol|
|00002320| 64 20 63 6c 69 70 70 69 | 6e 67 20 72 65 67 69 6f |d clippi|ng regio|
|00002330| 6e 20 61 6e 64 20 63 6c | 69 70 20 74 6f 20 77 72 |n and cl|ip to wr|
|00002340| 61 70 42 6f 78 2e 20 20 | 54 68 65 6e 2c 20 66 69 |apBox. |Then, fi|
|00002350| 67 75 72 65 0d 09 09 74 | 68 65 20 77 69 64 74 68 |gure...t|he width|
|00002360| 20 6f 66 20 77 72 61 70 | 42 6f 78 2c 20 61 6e 64 | of wrap|Box, and|
|00002370| 20 6d 61 6b 65 20 61 20 | 66 69 78 65 64 20 70 6f | make a |fixed po|
|00002380| 69 6e 74 20 76 65 72 73 | 69 6f 6e 20 6f 66 20 69 |int vers|ion of i|
|00002390| 74 2e 20 20 41 6c 73 6f | 2c 20 72 65 73 6f 6c 76 |t. Also|, resolv|
|000023a0| 65 0d 09 09 74 68 65 20 | 74 65 78 74 20 61 6c 69 |e...the |text ali|
|000023b0| 67 6e 6d 65 6e 74 20 74 | 65 46 6c 75 73 68 44 65 |gnment t|eFlushDe|
|000023c0| 66 61 75 6c 74 20 74 6f | 20 62 65 20 74 68 65 20 |fault to| be the |
|000023d0| 64 65 66 61 75 6c 74 20 | 73 79 73 74 65 6d 20 74 |default |system t|
|000023e0| 65 78 74 20 61 6c 69 67 | 6e 6d 65 6e 74 2e 0d 09 |ext alig|nment...|
|000023f0| 2a 2f 0d 0d 09 47 65 74 | 43 6c 69 70 28 28 6f 6c |*/...Get|Clip((ol|
|00002400| 64 43 6c 69 70 20 3d 20 | 4e 65 77 52 67 6e 28 29 |dClip = |NewRgn()|
|00002410| 29 29 3b 0d 09 43 6c 69 | 70 52 65 63 74 28 77 72 |));..Cli|pRect(wr|
|00002420| 61 70 42 6f 78 29 3b 0d | 09 62 6f 78 57 69 64 74 |apBox);.|.boxWidt|
|00002430| 68 20 3d 20 77 72 61 70 | 42 6f 78 2d 3e 72 69 67 |h = wrap|Box->rig|
|00002440| 68 74 20 2d 20 77 72 61 | 70 42 6f 78 2d 3e 6c 65 |ht - wra|pBox->le|
|00002450| 66 74 3b 0d 09 66 69 78 | 65 64 4d 61 78 20 3d 20 |ft;..fix|edMax = |
|00002460| 4c 6f 6e 67 32 46 69 78 | 28 28 6c 6f 6e 67 29 62 |Long2Fix|((long)b|
|00002470| 6f 78 57 69 64 74 68 29 | 3b 0d 09 69 66 20 28 61 |oxWidth)|;..if (a|
|00002480| 6c 69 67 6e 20 3d 3d 20 | 74 65 46 6c 75 73 68 44 |lign == |teFlushD|
|00002490| 65 66 61 75 6c 74 29 0d | 09 09 61 6c 69 67 6e 20 |efault).|..align |
|000024a0| 3d 20 47 65 74 53 79 73 | 4a 75 73 74 28 29 3b 0d |= GetSys|Just();.|
|000024b0| 09 0d 09 2f 2a 0d 09 09 | 4e 6f 77 20 77 65 20 63 |.../*...|Now we c|
|000024c0| 61 6c 6c 20 4e 54 42 4c | 69 6e 65 48 65 69 67 68 |all NTBL|ineHeigh|
|000024d0| 74 20 74 6f 20 63 61 6c | 63 75 6c 61 74 65 20 74 |t to cal|culate t|
|000024e0| 68 65 20 61 70 70 72 6f | 70 72 69 61 74 65 20 6c |he appro|priate l|
|000024f0| 69 6e 65 20 68 65 69 67 | 68 74 2e 20 20 49 74 0d |ine heig|ht. It.|
|00002500| 09 09 61 6c 73 6f 20 66 | 69 67 75 72 65 73 20 6f |..also f|igures o|
|00002510| 75 72 20 73 74 61 72 74 | 69 6e 67 20 76 65 72 74 |ur start|ing vert|
|00002520| 69 63 61 6c 20 70 65 6e | 20 6c 6f 63 61 74 69 6f |ical pen| locatio|
|00002530| 6e 20 69 6e 20 63 75 72 | 59 20 62 61 73 65 64 20 |n in cur|Y based |
|00002540| 6f 6e 20 74 68 65 0d 09 | 09 6c 69 6e 65 20 68 65 |on the..|.line he|
|00002550| 69 67 68 74 20 61 6e 64 | 20 6f 74 68 65 72 20 6d |ight and| other m|
|00002560| 65 74 72 69 63 20 70 61 | 72 61 6d 65 74 65 72 73 |etric pa|rameters|
|00002570| 2e 20 20 43 6c 65 61 72 | 20 6c 69 6e 65 43 6f 75 |. Clear| lineCou|
|00002580| 6e 74 2c 20 73 65 74 0d | 09 09 6c 69 6e 65 53 74 |nt, set.|..lineSt|
|00002590| 61 72 74 20 74 6f 20 70 | 6f 69 6e 74 20 74 6f 20 |art to p|oint to |
|000025a0| 74 68 65 20 62 65 67 69 | 6e 6e 69 6e 67 20 6f 66 |the begi|nning of|
|000025b0| 20 74 68 65 20 74 65 78 | 74 2c 20 63 61 6c 63 75 | the tex|t, calcu|
|000025c0| 6c 61 74 65 20 74 65 78 | 74 45 6e 64 20 66 6f 72 |late tex|tEnd for|
|000025d0| 0d 09 09 63 6f 6d 70 61 | 72 69 73 6f 6e 20 74 6f |...compa|rison to|
|000025e0| 20 6b 6e 6f 77 20 77 68 | 65 6e 20 77 65 27 72 65 | know wh|en we're|
|000025f0| 20 64 6f 6e 65 2c 20 61 | 6e 64 20 70 72 65 73 65 | done, a|nd prese|
|00002600| 74 20 74 65 78 74 4c 65 | 66 74 20 74 6f 20 62 65 |t textLe|ft to be|
|00002610| 20 61 6c 6c 20 74 68 65 | 0d 09 09 74 65 78 74 2e | all the|...text.|
|00002620| 0d 09 2a 2f 0d 0d 09 6c | 69 6e 65 48 65 69 67 68 |..*/...l|ineHeigh|
|00002630| 74 20 3d 20 4e 54 42 4c | 69 6e 65 48 65 69 67 68 |t = NTBL|ineHeigh|
|00002640| 74 28 74 68 65 54 65 78 | 74 2c 20 74 65 78 74 4c |t(theTex|t, textL|
|00002650| 65 6e 2c 20 77 72 61 70 | 42 6f 78 2c 20 6c 68 43 |en, wrap|Box, lhC|
|00002660| 6f 64 65 2c 20 26 63 75 | 72 59 29 3b 0d 09 6c 69 |ode, &cu|rY);..li|
|00002670| 6e 65 43 6f 75 6e 74 20 | 3d 20 30 3b 0d 09 6c 69 |neCount |= 0;..li|
|00002680| 6e 65 53 74 61 72 74 20 | 3d 20 74 68 65 54 65 78 |neStart |= theTex|
|00002690| 74 3b 0d 09 74 65 78 74 | 45 6e 64 20 3d 20 74 68 |t;..text|End = th|
|000026a0| 65 54 65 78 74 20 2b 20 | 74 65 78 74 4c 65 6e 3b |eText + |textLen;|
|000026b0| 0d 09 74 65 78 74 4c 65 | 66 74 20 3d 20 74 65 78 |..textLe|ft = tex|
|000026c0| 74 4c 65 6e 3b 0d 09 0d | 09 2f 2a 0d 09 09 54 68 |tLen;...|./*...Th|
|000026d0| 69 73 20 69 73 20 74 68 | 65 20 6d 61 69 6e 20 77 |is is th|e main w|
|000026e0| 72 61 70 2d 61 6e 64 2d | 64 72 61 77 20 6c 6f 6f |rap-and-|draw loo|
|000026f0| 70 2e 20 20 49 20 62 65 | 74 20 79 6f 75 20 6e 65 |p. I be|t you ne|
|00002700| 76 65 72 20 74 68 6f 75 | 67 68 74 20 77 72 61 70 |ver thou|ght wrap|
|00002710| 70 69 6e 67 0d 09 09 74 | 65 78 74 20 63 6f 75 6c |ping...t|ext coul|
|00002720| 64 20 62 65 20 73 6f 20 | 65 61 73 79 2e 2e 2e 0d |d be so |easy....|
|00002730| 09 2a 2f 0d 0d 09 64 6f | 20 7b 0d 09 09 0d 09 09 |.*/...do| {......|
|00002740| 2f 2a 0d 09 09 09 45 76 | 65 72 79 20 6c 69 6e 65 |/*....Ev|ery line|
|00002750| 2c 20 77 65 20 68 61 76 | 65 20 74 6f 20 70 72 65 |, we hav|e to pre|
|00002760| 73 65 74 20 6c 69 6e 65 | 42 79 74 65 73 20 74 6f |set line|Bytes to|
|00002770| 20 73 6f 6d 65 74 68 69 | 6e 67 20 6e 6f 6e 2d 7a | somethi|ng non-z|
|00002780| 65 72 6f 2e 0d 09 09 09 | 54 68 69 73 20 74 65 6c |ero.....|This tel|
|00002790| 6c 73 20 53 74 79 6c 65 | 64 4c 69 6e 65 42 72 65 |ls Style|dLineBre|
|000027a0| 61 6b 20 74 68 61 74 20 | 77 65 27 72 65 20 64 72 |ak that |we're dr|
|000027b0| 61 77 69 6e 67 20 74 68 | 65 20 66 69 72 73 74 20 |awing th|e first |
|000027c0| 66 6f 72 6d 61 74 0d 09 | 09 09 72 75 6e 20 6f 6e |format..|..run on|
|000027d0| 20 74 68 65 20 6c 69 6e | 65 20 28 6f 66 20 63 6f | the lin|e (of co|
|000027e0| 75 72 73 65 2c 20 66 6f | 72 20 75 73 2c 20 74 68 |urse, fo|r us, th|
|000027f0| 65 72 65 27 73 20 6f 6e | 6c 79 20 4f 4e 45 20 66 |ere's on|ly ONE f|
|00002800| 6f 72 6d 61 74 20 72 75 | 6e 0d 09 09 09 74 6f 74 |ormat ru|n....tot|
|00002810| 61 6c 29 2e 20 20 41 6c | 73 6f 20 70 72 65 73 65 |al). Al|so prese|
|00002820| 74 20 77 72 61 70 57 69 | 64 2e 20 20 53 74 79 6c |t wrapWi|d. Styl|
|00002830| 65 64 4c 69 6e 65 42 72 | 65 61 6b 20 77 69 6c 6c |edLineBr|eak will|
|00002840| 20 61 6c 77 61 79 73 20 | 6d 6f 64 69 66 79 0d 09 | always |modify..|
|00002850| 09 09 6c 69 6e 65 42 79 | 74 65 73 20 28 74 6f 20 |..lineBy|tes (to |
|00002860| 74 65 6c 6c 20 79 6f 75 | 20 68 6f 77 20 6d 61 6e |tell you| how man|
|00002870| 79 20 62 79 74 65 73 20 | 61 72 65 20 6f 6e 20 74 |y bytes |are on t|
|00002880| 68 69 73 20 6c 69 6e 65 | 29 2c 20 61 6e 64 20 77 |his line|), and w|
|00002890| 69 6c 6c 0d 09 09 09 6d | 6f 64 69 66 79 20 77 72 |ill....m|odify wr|
|000028a0| 61 70 57 69 64 2c 20 73 | 6f 20 77 65 20 68 61 76 |apWid, s|o we hav|
|000028b0| 65 20 74 6f 20 72 65 73 | 65 74 20 74 68 65 6d 20 |e to res|et them |
|000028c0| 65 61 63 68 20 6c 69 6e | 65 2e 0d 09 09 2a 2f 0d |each lin|e....*/.|
|000028d0| 09 09 0d 09 09 6c 69 6e | 65 42 79 74 65 73 20 3d |.....lin|eBytes =|
|000028e0| 20 31 3b 0d 09 09 77 72 | 61 70 57 69 64 20 3d 20 | 1;...wr|apWid = |
|000028f0| 66 69 78 65 64 4d 61 78 | 3b 0d 0d 09 09 62 72 65 |fixedMax|;....bre|
|00002900| 61 6b 43 6f 64 65 20 3d | 20 53 74 79 6c 65 64 4c |akCode =| StyledL|
|00002910| 69 6e 65 42 72 65 61 6b | 28 6c 69 6e 65 53 74 61 |ineBreak|(lineSta|
|00002920| 72 74 2c 20 74 65 78 74 | 4c 65 66 74 2c 20 30 2c |rt, text|Left, 0,|
|00002930| 20 74 65 78 74 4c 65 66 | 74 2c 20 30 2c 0d 09 09 | textLef|t, 0,...|
|00002940| 09 26 77 72 61 70 57 69 | 64 2c 20 26 6c 69 6e 65 |.&wrapWi|d, &line|
|00002950| 42 79 74 65 73 29 3b 0d | 09 09 0d 09 09 2f 2a 0d |Bytes);.|...../*.|
|00002960| 09 09 09 4e 6f 77 20 74 | 68 61 74 20 74 68 65 20 |...Now t|hat the |
|00002970| 53 63 72 69 70 74 20 4d | 61 6e 61 67 65 72 20 68 |Script M|anager h|
|00002980| 61 73 20 64 6f 6e 65 20 | 61 6c 6c 20 74 68 65 20 |as done |all the |
|00002990| 72 65 61 6c 6c 79 20 68 | 61 72 64 20 77 6f 72 6b |really h|ard work|
|000029a0| 20 66 6f 72 0d 09 09 09 | 75 73 2c 20 77 65 20 64 | for....|us, we d|
|000029b0| 72 61 77 20 74 68 65 20 | 6c 69 6e 65 2e 20 20 57 |raw the |line. W|
|000029c0| 65 20 61 6c 72 65 61 64 | 79 20 6b 6e 65 77 20 6c |e alread|y knew l|
|000029d0| 69 6e 65 53 74 61 72 74 | 2c 20 53 74 79 6c 65 64 |ineStart|, Styled|
|000029e0| 4c 69 6e 65 42 72 65 61 | 6b 0d 09 09 09 67 61 76 |LineBrea|k....gav|
|000029f0| 65 20 75 73 20 6c 69 6e | 65 42 79 74 65 73 2c 20 |e us lin|eBytes, |
|00002a00| 77 68 69 63 68 20 77 65 | 20 70 61 73 73 20 74 6f |which we| pass to|
|00002a10| 20 4e 54 42 44 72 61 77 | 2e 20 20 49 74 27 6c 6c | NTBDraw|. It'll|
|00002a20| 20 68 61 6e 64 6c 65 20 | 74 68 65 0d 09 09 09 64 | handle |the....d|
|00002a30| 69 66 66 65 72 65 6e 74 | 20 74 65 78 74 20 61 6c |ifferent| text al|
|00002a40| 69 67 6e 6d 65 6e 74 73 | 20 69 74 73 65 6c 66 2e |ignments| itself.|
|00002a50| 0d 09 09 2a 2f 0d 09 09 | 0d 09 09 4e 54 42 44 72 |...*/...|...NTBDr|
|00002a60| 61 77 28 62 72 65 61 6b | 43 6f 64 65 2c 20 6c 69 |aw(break|Code, li|
|00002a70| 6e 65 53 74 61 72 74 2c | 20 6c 69 6e 65 42 79 74 |neStart,| lineByt|
|00002a80| 65 73 2c 20 77 72 61 70 | 42 6f 78 2c 20 61 6c 69 |es, wrap|Box, ali|
|00002a90| 67 6e 2c 20 63 75 72 59 | 2c 20 62 6f 78 57 69 64 |gn, curY|, boxWid|
|00002aa0| 74 68 29 3b 0d 09 09 0d | 09 09 2f 2a 0d 09 09 09 |th);....|../*....|
|00002ab0| 4e 6f 77 20 77 65 20 61 | 64 76 61 6e 63 65 20 6f |Now we a|dvance o|
|00002ac0| 75 72 20 76 65 72 74 69 | 63 61 6c 20 70 6f 73 69 |ur verti|cal posi|
|00002ad0| 74 69 6f 6e 20 64 6f 77 | 6e 20 62 79 20 74 68 65 |tion dow|n by the|
|00002ae0| 20 68 65 69 67 68 74 20 | 6f 66 20 6f 6e 65 0d 09 | height |of one..|
|00002af0| 09 09 6c 69 6e 65 2c 20 | 61 64 76 61 6e 63 65 20 |..line, |advance |
|00002b00| 6c 69 6e 65 53 74 61 72 | 74 20 62 79 20 74 68 65 |lineStar|t by the|
|00002b10| 20 6e 75 6d 62 65 72 20 | 6f 66 20 62 79 74 65 73 | number |of bytes|
|00002b20| 20 77 65 20 6a 75 73 74 | 20 64 72 65 77 2c 0d 09 | we just| drew,..|
|00002b30| 09 09 63 61 6c 63 75 6c | 61 74 65 20 61 20 6e 65 |..calcul|ate a ne|
|00002b40| 77 20 74 65 78 74 4c 65 | 66 74 2c 20 61 6e 64 20 |w textLe|ft, and |
|00002b50| 69 6e 63 72 65 6d 65 6e | 74 20 6f 75 72 20 6c 69 |incremen|t our li|
|00002b60| 6e 65 20 63 6f 75 6e 74 | 2e 0d 09 09 2a 2f 0d 09 |ne count|....*/..|
|00002b70| 09 0d 09 09 63 75 72 59 | 20 2b 3d 20 6c 69 6e 65 |....curY| += line|
|00002b80| 48 65 69 67 68 74 3b 0d | 09 09 6c 69 6e 65 53 74 |Height;.|..lineSt|
|00002b90| 61 72 74 20 2b 3d 20 6c | 69 6e 65 42 79 74 65 73 |art += l|ineBytes|
|00002ba0| 3b 0d 09 09 74 65 78 74 | 4c 65 66 74 20 2d 3d 20 |;...text|Left -= |
|00002bb0| 6c 69 6e 65 42 79 74 65 | 73 3b 0d 09 09 6c 69 6e |lineByte|s;...lin|
|00002bc0| 65 43 6f 75 6e 74 2b 2b | 3b 0d 09 09 0d 09 7d 20 |eCount++|;.....} |
|00002bd0| 77 68 69 6c 65 20 28 6c | 69 6e 65 53 74 61 72 74 |while (l|ineStart|
|00002be0| 20 3c 20 74 65 78 74 45 | 6e 64 29 3b 0d 09 0d 09 | < textE|nd);....|
|00002bf0| 2f 2a 0d 09 09 57 65 6c | 6c 20 74 68 61 74 20 77 |/*...Wel|l that w|
|00002c00| 61 73 20 61 20 6a 6f 62 | 20 77 65 6c 6c 20 64 6f |as a job| well do|
|00002c10| 6e 65 2e 20 20 4c 65 74 | 27 73 20 72 65 74 75 72 |ne. Let|'s retur|
|00002c20| 6e 20 73 6f 6d 65 20 75 | 73 65 66 75 6c 20 76 61 |n some u|seful va|
|00002c30| 6c 75 65 73 2c 20 74 6f | 6f 2e 0d 09 09 49 66 20 |lues, to|o....If |
|00002c40| 74 68 65 20 75 73 65 72 | 20 67 61 76 65 20 70 6f |the user| gave po|
|00002c50| 69 6e 74 65 72 73 20 66 | 6f 72 20 65 6e 64 59 20 |inters f|or endY |
|00002c60| 61 6e 64 20 6c 68 55 73 | 65 64 2c 20 77 65 20 73 |and lhUs|ed, we s|
|00002c70| 74 75 66 66 20 6f 75 72 | 20 65 6e 64 69 6e 67 0d |tuff our| ending.|
|00002c80| 09 09 76 65 72 74 69 63 | 61 6c 20 63 6f 6f 72 64 |..vertic|al coord|
|00002c90| 69 6e 61 74 65 20 61 6e | 64 20 74 68 65 20 6c 69 |inate an|d the li|
|00002ca0| 6e 65 20 68 65 69 67 68 | 74 20 77 65 20 63 61 6c |ne heigh|t we cal|
|00002cb0| 63 75 6c 61 74 65 64 20 | 69 6e 74 6f 20 74 68 6f |culated |into tho|
|00002cc0| 73 65 2c 0d 09 09 72 65 | 73 70 65 63 74 69 76 65 |se,...re|spective|
|00002cd0| 6c 79 2e 20 20 54 68 65 | 73 65 20 61 6c 6c 6f 77 |ly. The|se allow|
|00002ce0| 20 74 68 65 20 67 75 79 | 20 74 6f 20 70 75 74 20 | the guy| to put |
|00002cf0| 73 6f 6d 65 74 68 69 6e | 67 20 61 66 74 65 72 20 |somethin|g after |
|00002d00| 74 68 65 20 77 72 61 70 | 70 65 64 0d 09 09 74 65 |the wrap|ped...te|
|00002d10| 78 74 20 28 6f 72 20 61 | 74 20 6c 65 61 73 74 20 |xt (or a|t least |
|00002d20| 6b 6e 6f 77 20 74 68 65 | 20 72 69 67 68 74 20 70 |know the| right p|
|00002d30| 6c 61 63 65 20 74 6f 20 | 70 75 74 20 69 74 29 2e |lace to |put it).|
|00002d40| 0d 09 2a 2f 0d 0d 09 69 | 66 20 28 65 6e 64 59 29 |..*/...i|f (endY)|
|00002d50| 0d 09 09 2a 65 6e 64 59 | 20 3d 20 63 75 72 59 20 |...*endY| = curY |
|00002d60| 2d 20 6c 69 6e 65 48 65 | 69 67 68 74 3b 0d 09 69 |- lineHe|ight;..i|
|00002d70| 66 20 28 6c 68 55 73 65 | 64 29 0d 09 09 2a 6c 68 |f (lhUse|d)...*lh|
|00002d80| 55 73 65 64 20 3d 20 6c | 69 6e 65 48 65 69 67 68 |Used = l|ineHeigh|
|00002d90| 74 3b 0d 09 0d 09 2f 2a | 0d 09 09 46 69 6e 61 6c |t;..../*|...Final|
|00002da0| 6c 79 2c 20 72 65 73 74 | 6f 72 65 20 74 68 65 20 |ly, rest|ore the |
|00002db0| 63 6c 69 70 70 69 6e 67 | 20 72 65 67 69 6f 6e 2c |clipping| region,|
|00002dc0| 20 64 69 73 70 6f 73 65 | 20 6f 66 20 74 68 65 20 | dispose| of the |
|00002dd0| 72 65 67 69 6f 6e 2c 20 | 61 6e 64 0d 09 09 72 65 |region, |and...re|
|00002de0| 74 75 72 6e 20 74 68 65 | 20 54 4f 54 41 4c 20 6e |turn the| TOTAL n|
|00002df0| 75 6d 62 65 72 20 6f 66 | 20 6c 69 6e 65 73 20 64 |umber of| lines d|
|00002e00| 72 61 77 6e 20 28 6e 6f | 74 65 20 74 68 61 74 20 |rawn (no|te that |
|00002e10| 77 65 20 64 69 64 6e 27 | 74 20 73 74 6f 70 0d 09 |we didn'|t stop..|
|00002e20| 09 64 72 61 77 69 6e 67 | 20 77 68 65 6e 20 63 75 |.drawing| when cu|
|00002e30| 72 59 20 61 64 76 61 6e | 63 65 64 20 70 61 73 74 |rY advan|ced past|
|00002e40| 20 77 72 61 70 42 6f 78 | 2d 3e 62 6f 74 74 6f 6d | wrapBox|->bottom|
|00002e50| 2e 20 20 54 68 69 73 20 | 77 61 79 2c 20 74 68 65 |. This |way, the|
|00002e60| 20 75 73 65 72 0d 09 09 | 63 6f 75 6c 64 20 74 65 | user...|could te|
|00002e70| 6c 6c 20 74 68 61 74 20 | 74 68 65 20 74 65 78 74 |ll that |the text|
|00002e80| 20 6f 76 65 72 66 6c 6f | 77 65 64 20 77 72 61 70 | overflo|wed wrap|
|00002e90| 42 6f 78 2e 20 20 49 66 | 20 79 6f 75 20 77 61 6e |Box. If| you wan|
|00002ea0| 74 20 74 6f 20 6b 6e 6f | 77 20 68 6f 77 0d 09 09 |t to kno|w how...|
|00002eb0| 6d 61 6e 79 20 6c 69 6e | 65 73 20 66 69 74 2c 20 |many lin|es fit, |
|00002ec0| 64 69 76 69 64 65 20 77 | 72 61 70 42 6f 78 20 62 |divide w|rapBox b|
|00002ed0| 79 20 6c 68 55 73 65 64 | 2e 20 20 54 68 69 73 20 |y lhUsed|. This |
|00002ee0| 77 61 79 2c 20 79 6f 75 | 20 67 65 74 20 74 68 65 |way, you| get the|
|00002ef0| 20 62 65 73 74 0d 09 09 | 6f 66 20 62 6f 74 68 20 | best...|of both |
|00002f00| 77 6f 72 6c 64 73 2e 0d | 09 2a 2f 0d 0d 09 53 65 |worlds..|.*/...Se|
|00002f10| 74 43 6c 69 70 28 6f 6c | 64 43 6c 69 70 29 3b 0d |tClip(ol|dClip);.|
|00002f20| 09 44 69 73 70 6f 73 65 | 52 67 6e 28 6f 6c 64 43 |.Dispose|Rgn(oldC|
|00002f30| 6c 69 70 29 3b 0d 0d 09 | 72 65 74 75 72 6e 28 6c |lip);...|return(l|
|00002f40| 69 6e 65 43 6f 75 6e 74 | 29 3b 0d 7d 0d 00 00 00 |ineCount|);.}....|
|00002f50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f80| 00 00 01 00 00 00 01 6e | 00 00 00 6e 00 00 00 3e |.......n|...n...>|
|00002f90| 00 01 e0 57 00 01 e0 58 | 00 00 e0 59 00 00 e0 5a |...W...X|...Y...Z|
|00002fa0| 00 00 e0 5b 00 00 e0 5c | 00 00 e0 5d 00 00 e0 5e |...[...\|...]...^|
|00002fb0| 0c 4e 65 6f 54 65 78 74 | 42 6f 78 2e 63 0b 02 00 |.NeoText|Box.c...|
|00002fc0| 00 00 54 45 58 54 4d 50 | 53 20 01 00 00 00 00 40 |..TEXTMP|S .....@|
|00002fd0| 00 00 54 45 58 54 4d 50 | 53 20 01 00 00 00 00 40 |..TEXTMP|S .....@|
|00002fe0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ff0| 00 00 a4 e3 ac 4b 00 00 | 2e cd 00 00 01 ac 03 37 |.....K..|.......7|
|00003000| 2e 30 24 37 2e 30 2c 20 | a9 41 70 70 6c 65 20 43 |.0$7.0, |.Apple C|
|00003010| 6f 6d 70 75 74 65 72 2c | 20 49 6e 63 2e 20 31 39 |omputer,| Inc. 19|
|00003020| 38 33 2d 31 39 39 31 00 | 00 00 04 03 37 2e 30 00 |83-1991.|....7.0.|
|00003030| 00 00 78 00 06 00 5a 00 | 00 00 0e 00 5f 00 00 00 |..x...Z.|...._...|
|00003040| 06 0b 54 00 5f 00 00 00 | 14 0a 54 00 5f 00 00 00 |..T._...|..T._...|
|00003050| 22 0c 54 00 5f 00 00 00 | 30 10 54 00 5f 00 00 00 |".T._...|0.T._...|
|00003060| 42 09 48 00 5f 00 00 00 | 48 0e 48 00 5f 00 00 00 |B.H._...|H.H._...|
|00003070| 56 11 48 00 5f 00 00 00 | 64 15 48 00 53 00 00 00 |V.H._...|d.H.S...|
|00003080| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 65 64 29 |...H..Mo|naco.ed)|
|00003090| 09 2f 2a 20 52 65 74 75 | 72 6e 73 20 74 68 65 20 |./* Retu|rns the |
|000030a0| 6e 75 6d 62 65 72 00 06 | 00 04 00 3c 00 24 01 dd |number..|...<.$..|
|000030b0| 02 3d 00 3c 00 24 01 dd | 02 3d a5 08 25 b8 00 00 |.=.<.$..|.=..%...|
|000030c0| 1c 36 00 00 1c 36 00 00 | 1c 37 01 00 00 00 00 1e |.6...6..|.7......|
|000030d0| 00 3c 00 24 01 dd 02 3d | 00 3c 00 24 01 dd 02 3d |.<.$...=|.<.$...=|
|000030e0| 00 00 1c 37 00 00 00 00 | 00 00 00 00 00 00 00 00 |...7....|........|
|000030f0| 01 00 00 00 01 6e 00 00 | 00 6e 00 00 00 3e 00 47 |.....n..|.n...>.G|
|00003100| 2b fc 0c 7e 00 00 00 1c | 00 3e 00 00 4d 50 53 52 |+..~....|.>..MPSR|
|00003110| 00 01 00 0a 03 ed ff ff | 00 00 00 00 00 00 00 00 |........|........|
|00003120| 03 f0 ff ff 00 00 00 4c | 00 49 2c 28 00 00 00 00 |.......L|.I,(....|
|00003130| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003140| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+